from pathlib import Path
from core.detector import BaseOSDetector

class FedoraDetector(BaseOSDetector):
    def detect(self) -> bool:
        # 方法1: 检查标识文件
        if self.check_file_exists("/etc/fedora-release"):
            return True
        
        # 方法2: 解析 os-release
        os_info = self.get_os_release()
        return os_info.get("ID") == "fedora"

    def get_version(self) -> str:
        """获取 Fedora 版本号 (e.g. 36/37)"""
        os_info = self.get_os_release()
        return os_info.get("VERSION_ID", "unknown")